import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index,
    redirect: '/index/main',
    children: [
      {
        path: 'main',
        name: 'index-main',
        component: () => import('../components/index/index-main')
      },
      {
        path: 'follow',
        name: 'index-follow',
        component: () => import('../components/index/index-follow')
      },
      {
        path: 'hot',
        name: 'index-hot',
        component: () => import('../components/index/index-hot')
      }
    ]
  },
  {
    path: '/found',
    name: 'Found',
    component: () => import('../views/found')
  },
  {
    path: '/answer',
    redirect: '/answer/recommend',
    component: () => import('../views/answer'),
    children: [
      {
        path: 'recommend',
        component: () => import('../components/answer/recommend')
      },
      {
        path: 'hot',
        component: () => import('../components/answer/hot')
      },
      {
        path: 'new',
        component: () => import('../components/answer/new')
      },
      {
        path: 'invite',
        component: () => import('../components/answer/invite')
      }
    ]
  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router